/* -*-c++-*- VirtualPlanetBuilder - Copyright (C) 1998-2007 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

#ifndef DATE_H
#define DATE_H 1

#include <vpb/Export>

#include <string>

namespace vpb
{

class VPB_EXPORT Date
{
    public:
    
        Date():
            year(0),
            month(0),
            day(0),
            hour(0),
            minute(0),
            second(0) {}

        bool operator < (const Date& rhs) const
        {
            if (year < rhs.year) return true;
            if (year > rhs.year) return false;
            if (month < rhs.month) return true;
            if (month > rhs.month) return false;
            if (day < rhs.day) return true;
            if (day > rhs.day) return false;
            if (minute < rhs.minute) return true;
            if (minute > rhs.minute) return false;
            return (second < rhs.second);
        }

        bool operator > (const Date& rhs) const
        {
            return rhs < *this;
        }

        bool operator == (const Date& rhs) const
        {
            return year == rhs.year &&
                   month == rhs.month &&
                   day == rhs.day &&
                   minute == rhs.minute &&
                   second == rhs.second;
        }

        bool operator != (const Date& rhs) const
        {
            return !(*this==rhs);
        }

        bool setWithDateOfLastModification(const std::string& filename);

        bool setWithCurrentDate();

        bool setWithDateString(const std::string& dateString);

        std::string getDateString() const;
        
    public:

        unsigned int year;
        unsigned int month;
        unsigned int day;
        unsigned int hour;
        unsigned int minute;
        unsigned int second;

};

}

#endif
